<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
class CheckController extends Controller
{
    //check
    public function check(Request $request)
    {
    	
    	$id = $request -> all();

    	// dd($id);
    	// $data = DB::table('goodsattr as a') 
     //        -> where('cid','=',$id)
     //        -> leftJoin('goodsattrdetails as d','a.name','=','d.goodsattrname')
     //        -> select('d.name','d.goodsattrname')
     //        -> get();
     //        
        $data=DB::table('goodsattr')->where('cid',$id)->get();

    	return response() -> json($data);
    	                    
    }

    public function check1(Request $request)
    {
    	
    	$id = $request -> only('id')['id'];
    	

    	$data = DB::table('goodsattr as a')
    			-> where('a.id','=',$id)
    			-> leftJoin('goodsattrdetails as d','d.goodsattrname','=','a.name')
    			-> select('d.name','d.id')
    			-> get();
    	
    	return response() -> json($data);
    }
    public function check2(Request $request)
    {
        
        $attrname = $request -> only('attrname')['attrname'];
        

        $data = DB::table('goodsattrdetails')
                -> where('goodsattrname','=',$attrname)
                -> get();
        
        return response() -> json($data);
    }
    public function check3(Request $request)
    {
        $id = $request -> only('id')['id'];
        $data = DB::table('cate')
                -> where('pid','=',$id)
                -> get();
        return response() -> json($data);
    }
   
}

